<%--
  Created by IntelliJ IDEA.
  User: 吴慧跃
  Date: 2022/5/16
  Time: 9:35
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<html>
<head>
    <title>列表</title>
    <link href="/static/css/bootstrap.css" rel="stylesheet">
    <script type="text/javascript" src="/static/js/jquery-3.2.1.js"></script>
    <script src="/static/js/echarts.js"></script>
</head>
<body>
<div class="container">
    <h2>当前用户：${uname}</h2>
    <form action="/manage/list" method="post">
        场馆：<select name="vid">
            <option value="">--请选择--</option>
        </select>
        项目类型：<select name="tid">
        <option value="">--请选择--</option>
        </select>
        场地：<select name="pid">
        <option value="">--请选择--</option>
        </select>
        <input type="submit" value="搜索">
         <input type="button" value="场馆设置" onclick="add()">
        <input type="button" value="统计报表" onclick="echars()">
    </form>
    <table class="table table-hover" style="text-align: center">
        <tr>
            <td>场馆</td>
            <td>项目类型</td>
            <td>场地</td>
            <td>开始时间</td>
            <td>结束时间</td>
            <td>价格</td>
            <td>最近更新时间</td>
            <td>最近更新人</td>
        </tr>
        <c:forEach items="${pg.list}" var="manage">
            <tr>
                <td>${manage.vname}</td>
                <td>${manage.tname}</td>
                <td>${manage.pname}</td>
                <td>${manage.startTime}</td>
                <td>${manage.endTime}</td>
                <td>${manage.price}</td>
                <td>
                    <fmt:formatDate value="${manage.created}" pattern="yyyy-MM-dd"/>
                </td>
                <td>${manage.uname}</td>
            </tr>
        </c:forEach>
    </table>
    <jsp:include page="/static/common/pages.jsp"/>
</div>
<script>
    function echars() {
        location="/manage/toEchars";
    }
    function add() {
        location="/manage/toAdd";
    }
    $(function () {
        $.get("/manage/getVid",function (list) {
            for (var i in list){
                $('[name="vid"]').append('<option value="'+list[i].vid+'">'+list[i].vname+'</option>');
            }
            $('[name="vid"]').val(${vo.vid});
        });
        $.get("/manage/getTid",function (list) {
            for (var i in list){
                $('[name="tid"]').append('<option value="'+list[i].tid+'">'+list[i].tname+'</option>');
            }
            $('[name="tid"]').val(${vo.tid});
        });
        $.get("/manage/getPid",function (list) {
            for (var i in list){
                $('[name="pid"]').append('<option value="'+list[i].pid+'">'+list[i].pname+'</option>');
            }
            $('[name="pid"]').val(${vo.pid});
        });
    })
</script>
</body>
</html>
